Page({
  data:{
    courses:[],
    courseId:0,
    coursePrice:0
  },
  onLoad: function() {
    this.courseList();
  },
  courseList: function(){
    let that = this;
    wx.request({
      url: 'http://localhost:8080/yoga/course/findAll',
      method:'POST',
      header: {
        "Authorization" : wx.getStorageSync('token')
      },
      data:{
        pageNum:1,
        pageSize:5
      },
      success(res){
        if(res.statusCode==200){
          let data = res.data.data;
          that.setData({
            courses:data
          });
        }else{
          console.log("加载失败");
        }
      },
    });
  },
  pay: function(e) {
    let that = this;
    this.data.courseId=e.currentTarget.dataset.aa;
    this.data.coursePrice=e.currentTarget.dataset.bb
    
    wx.navigateTo({
      url: '/pages/storeCoach/storeC?courseId='+this.data.courseId+'&coursePrice='+this.data.coursePrice
    })
  }
})